home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / computerjanitor / plugins / remove_lilo_plugin.py < prev    next >
Encoding:
Python Source  |  2009-04-27  |  1.6 KB  |  44 lines

  1. # remove_lilo_plugin.py - remove lilo if grub is also installed
  2. # Copyright (C) 2009  Canonical, Ltd.
  3. #
  4. # This program is free software: you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation, version 3 of the License.
  7. #
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11. # GNU General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program.  If not, see <http://www.gnu.org/licenses/>.
  15.  
  16.  
  17. import os
  18.  
  19. import logging
  20. import computerjanitor
  21. _ = computerjanitor.setup_gettext()
  22.  
  23.  
  24. class RemoveLiloPlugin(computerjanitor.Plugin):
  25.  
  26.     """Plugin to remove lilo if grub is also installed."""
  27.  
  28.     description = _("Remove lilo since grub is also installed."
  29.                     "(See bug #314004 for details.)")
  30.  
  31.     def __init__(self):
  32.         self.condition = ["jauntyPostDistUpgradeCache"]
  33.  
  34.     def get_cruft(self):
  35.         if "lilo" in self.app.apt_cache and "grub" in self.app.apt_cache:
  36.             lilo = self.app.apt_cache["lilo"]
  37.             grub = self.app.apt_cache["grub"]
  38.             if lilo.isInstalled and grub.isInstalled:
  39.                 if not os.path.exists("/etc/lilo.conf"):
  40.                     yield computerjanitor.PackageCruft(lilo, self.description)
  41.                 else:
  42.                     logging.warning("lilo and grub installed, but "
  43.                                     "lilo.conf exists")
  44.